package com.fy.restfulapi.exception;

import com.fy.restfulapi.constant.CommonErrorCode;

/**
 * @author sunlei
 */
public class BusinessException extends BaseException {
    /**
     * 自定义异常编码
     */
    private Integer code;

    public BusinessException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(CommonErrorCode resultCode) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
    }

    public BusinessException(CommonErrorCode resultCode, String msg) {
        super(resultCode.getMessage() +" " + msg);
        this.code = resultCode.getCode();
    }

    // getter、setter
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
